package com.example.springboot.hl7;

import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
@EnableConfigurationProperties(HL7ServiceProperties.class)
public class HL7Configuration {

    @Bean
    public HL7ServiceInfo startMLLPService(HL7ServiceProperties hl7ServiceProperties){
        HL7ServiceInfo serviceInfo = new HL7ServiceInfo();
        serviceInfo.setPort(hl7ServiceProperties.getPort());
        new Thread(()-> HL7ServiceUtils.startMLLPService(serviceInfo)).start();
        return serviceInfo;
    }

}
